package com.stanyung.nativestart;

import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.stanyung.common.Log;
import com.stanyung.nativestart.inter.LadyService;
import com.stanyung.nativestart.model.Lady;

public class MainActivity extends Activity {
	
	private static final String tag = "Java-MainActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		LadyService service = new LadyService();
		
		Lady lady = new Lady(520L, "Honey", 18);
		String[] addrs = {"广州市", "深圳市", "珠海市"};
		double[] distances = {360.8, 250.4, 489.7};
		
		service.deleteLady(520L);
		
		boolean suc = service.updateLady(520L, lady);
		
		Lady lady2 = service.addLady("Honey", 18, addrs, distances);
		Log.v(tag, "lady's ID is %d, name is %s, age is %d", lady2.getLadyId(), lady2.getName(), lady2.getAge());
		
		Lady[] ladyArray = service.queryLadyArray(10);
		for(Lady l : ladyArray) {
			Log.v(tag, "ladyArray.lady's ID is %d, name is %s, age is %d", lady2.getLadyId(), lady2.getName(), lady2.getAge());
		}
		
		service.queryLadyList();
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	static {
		System.loadLibrary("ImNative");
	}
	
}
